package cn.zhentao.service.impl;

import cn.zhentao.dao.UserDao;
import cn.zhentao.pojo.Permissions;
import cn.zhentao.pojo.Role;
import cn.zhentao.pojo.User;
import cn.zhentao.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User login(String userName, String password) {
        return userDao.login(userName, password);
    }

    @Override
    public User findById(int userId) {
        return userDao.findById(userId);
    }

    @Override
    public List<Role> getUserRolesById(int userId) {
        return userDao.getUserRolesById(userId);
    }

    @Override
    public List<Permissions> getUserPermissionsByRoleId(int roleId) {
        return userDao.getUserPermissionsByRoleId(roleId);
    }
}
